package com.wjc.train.business.config;


import com.wjc.train.common.interceptor.BusinessInterceptor;
import com.wjc.train.common.interceptor.LogInterceptor;
import com.wjc.train.common.interceptor.MemberInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Guessed
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {

   @Resource
   LogInterceptor logInterceptor;

   @Resource
   BusinessInterceptor businessInterceptor;

    @Resource
    MemberInterceptor memberInterceptor;


    @Override
   public void addInterceptors(InterceptorRegistry registry) {
       registry.addInterceptor(logInterceptor);
       registry.addInterceptor(memberInterceptor);

       registry.addInterceptor(businessInterceptor)
               .addPathPatterns("/**")
               .excludePathPatterns(
                       "/hello",
                       "/admin/send-code",
                       "/admin/login",
                       "/sms/getRes"
               );

   }
}
